<!DOCTYPE html
  PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  "DTD/xhtml1-strict.dtd">
<html>
  <head>
    <title>navistore.backend.nsqlite.SqliteStorageBackend : API documentation</title>
    <meta content="text/html;charset=utf-8" http-equiv="Content-Type" />
    <link href="apidocs.css" type="text/css" rel="stylesheet" />
    
    
  </head>
  <body>
    <h1 class="class">n.b.n.SqliteStorageBackend(<a href="navistore.backend.iface.StorageBackend.html">iface.StorageBackend</a>) : class documentation</h1>
    <p>
      <span id="part">Part of <a href="navistore.html">navistore</a>.<a href="navistore.backend.html">backend</a>.<a href="navistore.backend.nsqlite.html">nsqlite</a></span>
      
      <a href="classIndex.html#navistore.backend.nsqlite.SqliteStorageBackend">View In Hierarchy</a>
    </p>
    <div>
      
    </div>
    <pre>This class implements the Navistore backend interface and provides 
support for storing data via sqlite3.

sqlite and its corrosponding python bindings
need to be installed on the system.

Please note that in order to increase performance
the default operation mode is to rely on sqlite3's
default commit model, as explained here:
- http://docs.python.org/library/sqlite3.html#sqlite3-controlling-transactions

For more reliable, but slower operation (this is always a trade off)
set sync = True on the backend object after instantiation.

This will cause a commit to be made for every save() and delete()
call and will ensure data consistency even across power failures,
unless ofcourse the failure happens while the file is being written.</pre>

    
    
    <div id="splitTables">
      <table class="children sortable" id="id11">
  
  
<tr class="method">
    
    
    <td>Method</td>
    <td><a href="navistore.backend.nsqlite.SqliteStorageBackend.html#__init__">__init__</a></td>
    <td><span>Any required initialization shold go</span></td>
  </tr><tr class="method">
    
    
    <td>Method</td>
    <td><a href="navistore.backend.nsqlite.SqliteStorageBackend.html#listkeys">listkeys</a></td>
    <td><span>Logic to list all the keys</span></td>
  </tr><tr class="method">
    
    
    <td>Method</td>
    <td><a href="navistore.backend.nsqlite.SqliteStorageBackend.html#haskey">haskey</a></td>
    <td><span>Return True if key is in store,</span></td>
  </tr><tr class="method">
    
    
    <td>Method</td>
    <td><a href="navistore.backend.nsqlite.SqliteStorageBackend.html#save">save</a></td>
    <td><span>Logic to store the value held by</span></td>
  </tr><tr class="method">
    
    
    <td>Method</td>
    <td><a href="navistore.backend.nsqlite.SqliteStorageBackend.html#get">get</a></td>
    <td><span>Returns the value referenced by</span></td>
  </tr><tr class="method">
    
    
    <td>Method</td>
    <td><a href="navistore.backend.nsqlite.SqliteStorageBackend.html#delete">delete</a></td>
    <td><span>Delete a value from the store by the</span></td>
  </tr><tr class="method">
    
    
    <td>Method</td>
    <td><a href="navistore.backend.nsqlite.SqliteStorageBackend.html#reset">reset</a></td>
    <td><span class="undocumented">Undocumented</span></td>
  </tr><tr class="method">
    
    
    <td>Method</td>
    <td><a href="navistore.backend.nsqlite.SqliteStorageBackend.html#close">close</a></td>
    <td><span>Documentation of sqlite tells us we must explicitly call commit</span></td>
  </tr>
  
</table>
      
      
    </div>
    
    
    

    <div class="function">
  <a name="navistore.backend.nsqlite.SqliteStorageBackend.__init__">
    
  </a>
  <a name="__init__">
    
  </a>
  <div class="functionHeader">
    
    def
    __init__(self, storepath=None):
    
  </div>
  <div class="functionBody">
    <div class="interfaceinfo">overrides <a href="navistore.backend.iface.StorageBackend.html#__init__">navistore.backend.iface.StorageBackend.__init__</a></div>
    <div>Any required initialization shold go here.</p>
<p>If the backend failed to initialize its environment like files, dirs, 
services this method should throw an expection with appropriate error.<table class="fieldTable"></table></div>
  </div>
</div><div class="function">
  <a name="navistore.backend.nsqlite.SqliteStorageBackend.listkeys">
    
  </a>
  <a name="listkeys">
    
  </a>
  <div class="functionHeader">
    
    def
    listkeys(self, max=None):
    
  </div>
  <div class="functionBody">
    <div class="interfaceinfo">overrides <a href="navistore.backend.iface.StorageBackend.html#listkeys">navistore.backend.iface.StorageBackend.listkeys</a></div>
    <div>Logic to list all the keys that are currently in the store.</p>
<p>Should return a Python list populated with the keys.<table class="fieldTable"></table></div>
  </div>
</div><div class="function">
  <a name="navistore.backend.nsqlite.SqliteStorageBackend.haskey">
    
  </a>
  <a name="haskey">
    
  </a>
  <div class="functionHeader">
    
    def
    haskey(self, key):
    
  </div>
  <div class="functionBody">
    <div class="interfaceinfo">overrides <a href="navistore.backend.iface.StorageBackend.html#haskey">navistore.backend.iface.StorageBackend.haskey</a></div>
    <div>Return True if key is in store, False otherwise.<table class="fieldTable"></table></div>
  </div>
</div><div class="function">
  <a name="navistore.backend.nsqlite.SqliteStorageBackend.save">
    
  </a>
  <a name="save">
    
  </a>
  <div class="functionHeader">
    
    def
    save(self, key, value):
    
  </div>
  <div class="functionBody">
    <div class="interfaceinfo">overrides <a href="navistore.backend.iface.StorageBackend.html#save">navistore.backend.iface.StorageBackend.save</a></div>
    <div>Logic to store the value held by 'value' into the store, to be 
accessible through the 'key' key.</p>
<p>Just returnes on success, should raise a storage backend exception 
otherwise.<table class="fieldTable"></table></div>
  </div>
</div><div class="function">
  <a name="navistore.backend.nsqlite.SqliteStorageBackend.get">
    
  </a>
  <a name="get">
    
  </a>
  <div class="functionHeader">
    
    def
    get(self, key):
    
  </div>
  <div class="functionBody">
    <div class="interfaceinfo">overrides <a href="navistore.backend.iface.StorageBackend.html#get">navistore.backend.iface.StorageBackend.get</a></div>
    <div>Returns the value referenced by the key 'key'<table class="fieldTable"></table></div>
  </div>
</div><div class="function">
  <a name="navistore.backend.nsqlite.SqliteStorageBackend.delete">
    
  </a>
  <a name="delete">
    
  </a>
  <div class="functionHeader">
    
    def
    delete(self, key, getvalue=False):
    
  </div>
  <div class="functionBody">
    <div class="interfaceinfo">overrides <a href="navistore.backend.iface.StorageBackend.html#delete">navistore.backend.iface.StorageBackend.delete</a></div>
    <div>Delete a value from the store by the key 'key'.</p>
<p>If getvalue is True, return the deleted value prior to deleting it.</p>
<p>Returns True if succeded, False otherwise.<table class="fieldTable"></table></div>
  </div>
</div><div class="function">
  <a name="navistore.backend.nsqlite.SqliteStorageBackend.reset">
    
  </a>
  <a name="reset">
    
  </a>
  <div class="functionHeader">
    
    def
    reset(self):
    
  </div>
  <div class="functionBody">
    
    <div class="undocumented">Undocumented</div>
  </div>
</div><div class="function">
  <a name="navistore.backend.nsqlite.SqliteStorageBackend.close">
    
  </a>
  <a name="close">
    
  </a>
  <div class="functionHeader">
    
    def
    close(self):
    
  </div>
  <div class="functionBody">
    <div class="interfaceinfo">overrides <a href="navistore.backend.iface.StorageBackend.html#close">navistore.backend.iface.StorageBackend.close</a></div>
    <div>Documentation of sqlite tells us we must explicitly call commit to 
commit last transaction before closing the connection, or otherwise changes
will be lost<table class="fieldTable"></table></div>
  </div>
</div>
    <address>
      <a href="index.html">API Documentation</a> for navistore, generated by <a href="http://codespeak.net/~mwh/pydoctor/">pydoctor</a> at 2010-11-13 15:44:55.
    </address>
  </body>
</html>